﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QntPlatform.Common
{
    public class Result
    {
        public int Code { get; set; }
        public string Message { get; set; }

        public static Result<T> Success<T>(T data) {
            return new Result<T>() { Code = 1200, Data = data };
        }
        public static Result Error(string msg) {
            return new Result() { Code = 1400, Message = msg };
        }
    }
    public class Result<T> : Result
    {
        public T Data { get; set; }
    }

    /// <summary>
    /// 返回Code
    /// </summary>
    public enum RCode
    {
        /// <summary>
        /// 成功
        /// </summary>
        Success = 1000,

        /// <summary>
        /// 登录超时,需重新登录
        /// </summary>
        NeedLogin = 2000,

        /// <summary>
        /// 程序异常
        /// </summary>
        Exception = 4000,

        /// <summary>
        /// 系统错误
        /// </summary>
        SysError = 5000
    }
}
